﻿--[[
   @brief    tqos
   @author   seanyxie
   @version  1.0
   @date     2015-04-08
--]]

tqos_mgr =
{
    
    qos_btn_id = {
        MAINWINDOW_LIBAO_BTN = 1,     
        MAINWINDOW_TOOL_BTN = 2,        
        MAINWINDOW_GNEWS_BTN = 3,        
        MAINWINDOW_PLAYER_AVATAR = 4,     
        MAINWINDOW_PLAYER_CARD = 5,     
        MAINWINDOW_GAME_CENTER = 6,       
        MAINWINDOW_MENU_SKIN = 7,         
        MAINWINDOW_MENU_ADD_GAME = 8,     
        MAINWINDOW_CURRENT_GAME = 9,     
        MAINWINDOW_MY_GAME = 10,     
        MAINWINDOW_EVENT_BTN = 11,      
        MAINWINDOW_TGP_LEVEL_BTN = 12,
        MAINWINDOW_BOTTOM_GIFT_BTN = 13,
        MAINWINDOW_BOTTOM_PRIVILEGE_BTN = 14,
        MINIWINDOW_TGP_CLOSE_BTN = 15,
        MINIWINDOW_TGP_MIN_BTN = 16,
        MINIWINDOW_TGP_MAXMODE_BTN = 17,
        MAINWINDOW_TGP_MOBILE_BTN = 18,
        MAINWINDOW_TGP_MAX_TO_MIN = 19,
        MINIWINDOW_TGP_MIN_TO_MAX = 20,
        MAINWINDOW_TGP_CLOSE_BTN = 21,
        MAINWINDOW_TGP_MIN_BTN = 22,

        MAINWINDOW_TGP_WELL_CHOSEN = 23,
        MAINWINDOW_TGP_GAME_LIBRARY = 24,
        MAINWINDOW_TGP_GAME_LIVE = 25,
        MAINWINDOW_TGP_PRIVILEGE_GIFT = 26,
        MAINWINDOW_TGP_MYGAME_ADD_BTN = 27,
        MAINWINDOW_TGP_WONDERFUL_EXPEND_BTN = 28,
        MAINWINDOW_TGP_WONDERFUL_UNEXPEND_BTN = 29,

        MAINWINDOW_MF_USERGUIDE_STEP1_SHOW = 30,
        MAINWINDOW_MF_USERGUIDE_STEP1_CLICK_EXIT = 31,
        MAINWINDOW_MF_USERGUIDE_STEP1_GO = 32,
        MAINWINDOW_MF_USERGUIDE_STEP2_SHOW = 33,
        MAINWINDOW_MF_USERGUIDE_STEP2_CLICK_EXIT = 34,
        MAINWINDOW_MF_USERGUIDE_STEP3_SHOW = 35,
        MAINWINDOW_MF_USERGUIDE_STEP3_CLICK_EXIT = 36,
        MAINWINDOW_MF_USERGUIDE_STEP4_SHOW = 37,
        MAINWINDOW_MF_USERGUIDE_STEP4_CLICK_EXIT = 38,
        MAINWINDOW_MF_USERGUIDE_STEP5_SHOW = 39,
        MAINWINDOW_MF_USERGUIDE_STEP5_CLICK_EXIT = 40,
        MAINWINDOW_MF_USERGUIDE_STEP6_SHOW = 41,
        MAINWINDOW_MF_USERGUIDE_STEP6_CLICK_EXIT = 42,
        MAINWINDOW_MF_USERGUIDE_STEP6_CLICK_FINISH = 43,
        MAINWINDOW_MULTITAB_BROWSER_GOTO_TGP = 44,

        MAINWINDOW_BANNER_PREDOWNLOAD = 50,
        MAINWINDOW_BANNER_ACC = 51,
        MAINWINDOW_BANNER_PRIVILEGE = 52,

        MAINWINDOW_ANCHOR_SUBSCRIBE_TIPS = 80,
        MAINWINDOW_ANCHOR_SUBSCRIBE_LIVE = 81,
        MAINWINDOW_ANCHOR_SUBSCRIBE_MORE = 82,
        MAINWINDOW_ANCHOR_SUBSCRIBE_CLOSE = 83,

        MAINWINDOW_GAME_UPDATE_TIPS = 100,
        MAINWINDOW_GAME_UPDATE_CLOSE = 101,
        MAINWINDOW_GAME_UPDATE_BANNER = 102,

        MINIWINDOW_TGP_MENU_BTN = 103,
        
        MAINWINDOW_MTGP_ENTRY_CLICK = 104,

        -- 自动更新功能Btn ID
        UPDATE_GUIDE_DISPALY = 110,
        UPDATE_GUIDE_CLOSE   = 111,
        UPDATE_GUIDE_MORE    = 112,
        UPDATE_GUIDE_OPEN    = 113,

        -- 游戏管家相关上报
        MAINWINDOW_GAME_MGR_BTN = 120,         -- 管家入口按钮
        MAINWINDOW_BIG_EVT_BANNER = 121,       -- 大事件banner节点点击
        MAINWINDOW_BIG_EVT_DOWNLOAD = 122,     -- 大事件banner下载按钮点击
        MAINWINDOW_GAME_MGR_NOGAME_TIPS = 123, -- 0款游戏tips，管家查找按钮点击

        MAINWINDOW_VIDEO_SUBSCRIBE_TIPS = 124,
        MAINWINDOW_VIDEO_SUBSCRIBE_CLICK = 125,
        MAINWINDOW_VIDEO_SUBSCRIBE_CLOSE = 126,

      };

    group_tab_click_count = 0;  -- 主面板群组tab点击次数统计
    friend_tab_click_count = 0; -- 主面板好友tab点击次数统计
    game_tab_click_count = 0; -- 主面板游戏tab点击次数统计
    group_tab_click_count_max_mode = 0;    -- 大界面群组tab点击次数
    friend_tab_click_count_max_mode = 0;    -- 大界面好友tab点击次数


    send_invite_count = 0;  -- 发送的邀请进群次数
    receive_invite_count = 0;  -- 收到的邀请进群次数

    friend_mini_card_show_success_count = 0;
    friend_mini_card_show_game_info_success_count = 0;
    vip_hover_count = 0; --勋章icon hover次数
    self_mini_card_show_success_count  = 0; --hover显示出自己mini资料卡的次数
    self_mini_card_show_game_info_success_count  = 0; --hover显示出自己mini资料卡中游戏数据的次数

    tray_hover_wnd_show_count = 0; --数据统计：tips浮层触发展示数量和用户量
    tray_hover_wnd_click_on_msg_box_count = 0; --数据统计：在浮层中，点击消息盒子量
    tray_hover_wnd_click_on_talk_msg_count = 0; --数据统计：在浮层中，点击“聊天消息节点”，提取单个消息窗口数量
    tray_hover_wnd_click_ingore_count = 0; --数据统计：点击“忽略全部”的数量
    tray_hover_wnd_click_view_all_count = 0; --数据统计：点击“查看全部”的数量
    tray_icon_click_open_talk_wnd_count = 0; -- 数据统计：点击闪烁图盘图标打开聊天窗口的次数
    tray_icon_click_open_msg_wnd_count = 0; -- 数据统计：点击闪烁图盘图标打开消息盒子的次数
    tray_icon_trig_talk_flash_count  = 0;  -- 数据统计：聊天消息触发托盘图标闪烁的次数
    tray_icon_trig_msg_flash_count  = 0;  -- 数据统计：系统消息消息触发托盘图标闪烁的次数

    --群组查找菜单点击统计
    group_search_menu_click_cnt         = 0;
    group_search_menu_find_click_cnt    = 0;
    group_search_menu_create_click_cnt  = 0;
    --好友查找菜单点击统计
    friend_search_menu_click_cnt                    = 0;
    friend_search_menu_qq_click_cnt                 = 0;
    friend_search_menu_game_click_cnt               = 0;
    friend_search_menu_nick_click_cnt               = 0;
    -- 大界面群组查找菜单点击统计
    group_search_menu_click_cnt_max_mode = 0;
    group_search_menu_find_click_cnt_max_mode = 0;
    group_search_menu_create_click_cnt_max_mode = 0;
    --大界面好友查找菜单点击统计
    friend_search_menu_click_cnt_max_mode = 0;
    friend_search_menu_qq_click_cnt_max_mode = 0;
    friend_search_menu_game_click_cnt_max_mode = 0;
    friend_search_menu_nick_click_cnt_max_mode = 0;

    --社交无好友、无群组引导点击次数
    guide_find_qq_friend_click_cnt          = 0;
    guide_find_game_friend_click_cnt        = 0;
    guide_find_group_click_cnt              = 0;

    -- 社交面板默认展示次数
    social_panel_default_show_cnt = 0;
    -- 好友分组，群分组，讨论组分组点击次数
    socail_friend_title_click_cnt = 0;
    socail_disc_title_click_cnt = 0;
    socail_group_title_click_cnt = 0;

    -- 
    show_friend_gams_info_wnd_cnt = 0;  --hover tisp显示 游戏好友信息窗口次数
    show_friend_gams_info_wnd_click_all_btn_cnt = 0;  --点击查看全部的次数

    mini_mode_social_ad_show_cnt = 0;  --迷你模式下，推广tips的曝光量
    mini_mode_social_ad_click_cnt = 0;  --迷你模式下，推广tips的点击量
    mini_mode_social_ad_colse_cnt = 0;  --迷你模式下，推广tips的关闭量

    social_panel_bottom_menu_click_cnt = 0; --查找添加入口的点击量和点击人数
    social_panel_msg_tabl_show_times = 0;   --消息tab的曝光量
    social_panel_contact_tabl_show_times = 0; -- 联系人tab的曝光量与曝光人数
    social_panel_friend_list_show_times = 0; -- 联系人tab中我的好友分组的曝光量
    social_panel_group_list_show_times = 0; -- 联系人tab中群组/聊天房间分组的曝光量

    click_live_room_entry_cnt = 0; --联系tab-话题房间入口点击次数
    click_live_room_msg_node_cnt = 0; --消息tab-话题房间消息节点点击次数
    click_on_exit_live_room_cnt = 0;  --退出入口点击量(包含web)
    click_on_exit_live_and_success_room_cnt = 0;  --退出房间成功的次数(包含web)
    click_on_exit_live_and_failure_room_cnt = 0;  --退出房间失败的次数(包含web)

    --
    click_create_discussion_btn_cnt = 0;

    qos_btn_click_count = {};

    init = function()
        base_utility.log("[tqos_mgr]tqos_mgr init");
        local tpfui =
            base_utility.get_component_adapter("ITpf_ui",
                "ierd_tgp.tpf_ui.GetTPFUI();");
        tpfui:AddLuaListener(ierd_tgp.tpf_ui.TPF_UI_APP_EXIT, "tqos_mgr.at_exit");
        tqos_mgr.qos_btn_click_count = {};
    end;

    remember_btn_clicked = function(btnname)
        local sub_id = tqos_mgr.qos_btn_id[btnname];
        if sub_id ~= nil then
            base_utility.log("[remember_btn_clicked]index:"..btnname..", sub_id:"..sub_id);
            if tqos_mgr.qos_btn_click_count[sub_id] == nil then
                tqos_mgr.qos_btn_click_count[sub_id] = 1;
            else
                tqos_mgr.qos_btn_click_count[sub_id] = tqos_mgr.qos_btn_click_count[sub_id] + 1;
            end
        end;
    end;

    --数据统计：tips浮层触发展示数量和用户量
    increase_tray_hover_wnd_show_count = function()
        tqos_mgr.tray_hover_wnd_show_count = tqos_mgr.tray_hover_wnd_show_count + 1;
    end;

    --hover mini资料卡操作统计-----------------------------------------------
    increase_friend_card_show_success_count = function()
        tqos_mgr.friend_mini_card_show_success_count = tqos_mgr.friend_mini_card_show_success_count + 1;
        base_utility.log("[tqos_mgr] increase_friend_card_show_success_count:"..tostring(tqos_mgr.friend_mini_card_show_success_count));
    end;

    increase_friend_card_show_game_info_success_count = function()
        tqos_mgr.friend_mini_card_show_game_info_success_count = tqos_mgr.friend_mini_card_show_game_info_success_count + 1;
        base_utility.log("[tqos_mgr] increase_friend_card_show_game_info_success_count:"..tostring(tqos_mgr.friend_mini_card_show_game_info_success_count));
    end;

    increase_hover_vip_tips_count = function()
        tqos_mgr.vip_hover_count = tqos_mgr.vip_hover_count + 1;
        base_utility.log("[tqos_mgr] increase_hover_vip_tips_count:"..tostring(tqos_mgr.vip_hover_count));
    end;

    report_friend_mini_card_count = function()
        if tqos_mgr.friend_mini_card_show_success_count > 0 or tqos_mgr.friend_mini_card_show_game_info_success_count > 0 or tqos_mgr.vip_hover_count > 0 then
            base_utility.log("[tqos_mgr] friend_mini_card_show_success_count:"..tonumber(tqos_mgr.friend_mini_card_show_success_count)..",friend_mini_card_show_game_info_success_count:"..tonumber(tqos_mgr.friend_mini_card_show_game_info_success_count)..",vip_hover_count:"..tonumber(tqos_mgr.vip_hover_count), true);
            local qosparam = ierd_tgp.tpf_ui.LuaQosData:new();
            qosparam.oc_type = ierd_tgp.tpf_ui.kInstant;
            qosparam.qos_report_id = ierd_tgp.adapt_for_imports.qos.Qos_kind.kFriendMiniCard; 
            qosparam.int_count = 3;
            qosparam.str_count = 0;
            qosparam.int_val[0]= tqos_mgr.friend_mini_card_show_success_count;
            qosparam.int_val[1]= tqos_mgr.friend_mini_card_show_success_count - tqos_mgr.friend_mini_card_show_game_info_success_count;
            qosparam.int_val[2]= tqos_mgr.vip_hover_count;
            if qosparam.int_val[1] < 0 then
                qosparam.int_val[1] = 0; 
            end
            base_utility.lua_qos(qosparam);
            qosparam:delete();
        end
    end;

    increase_self_card_show_success_count = function()
        base_utility.log("[tqos_mgr] increase_self_card_show_success_count");
        tqos_mgr.self_mini_card_show_success_count = tqos_mgr.self_mini_card_show_success_count + 1;
    end;

    increase_self_card_show_game_info_success_count = function()
        base_utility.log("[tqos_mgr] increase_self_card_show_game_info_success_count");
        tqos_mgr.self_mini_card_show_game_info_success_count = tqos_mgr.self_mini_card_show_game_info_success_count + 1;
    end;


    report_self_mini_card_count = function()
        if tqos_mgr.self_mini_card_show_success_count > 0 or tqos_mgr.self_mini_card_show_game_info_success_count > 0 then
            base_utility.log("[tqos_mgr] self_mini_card_show_success_count:"..tonumber(tqos_mgr.self_mini_card_show_success_count)..",self_mini_card_show_game_info_success_count:"..tonumber(tqos_mgr.self_mini_card_show_game_info_success_count), true);
            local qosparam = ierd_tgp.tpf_ui.LuaQosData:new();
            qosparam.oc_type = ierd_tgp.tpf_ui.kInstant;
            qosparam.qos_report_id = ierd_tgp.adapt_for_imports.qos.Qos_kind.kSelfMiniCard; 
            qosparam.int_count = 2;
            qosparam.str_count = 0;
            qosparam.int_val[0]= tqos_mgr.self_mini_card_show_success_count;
            qosparam.int_val[1]= tqos_mgr.self_mini_card_show_success_count - tqos_mgr.self_mini_card_show_game_info_success_count;
            if qosparam.int_val[1] < 0 then
                qosparam.int_val[1] = 0;
            end
            base_utility.lua_qos(qosparam);
            qosparam:delete();
        end
    end;
    ----------------------------------------------------------------------------

    increase_send_invite_count = function()
        base_utility.log("[tqos_mgr] increase_send_invite_count");
        tqos_mgr.send_invite_count = tqos_mgr.send_invite_count + 1;
    end;

    increase_receive_invite_count = function()
        base_utility.log("[tqos_mgr] increase_receive_invite_count");
        tqos_mgr.receive_invite_count = tqos_mgr.receive_invite_count + 1;
    end;

    report_invite_count = function()
        if tqos_mgr.send_invite_count > 0 or tqos_mgr.receive_invite_count > 0 then
            base_utility.log("[tqos_mgr] send_invite_count:"..tonumber(tqos_mgr.send_invite_count)..", receive_invite_count:"..tonumber(tqos_mgr.receive_invite_count), true);
            local qosparam = ierd_tgp.tpf_ui.LuaQosData:new();
            qosparam.oc_type = ierd_tgp.tpf_ui.kInstant;
            qosparam.qos_report_id = ierd_tgp.adapt_for_imports.qos.Qos_kind.kGroupInviteAction;
            qosparam.int_count = 2;
            qosparam.str_count = 0;
            qosparam.int_val[0]= tqos_mgr.send_invite_count;
            qosparam.int_val[1]= tqos_mgr.receive_invite_count;
            base_utility.lua_qos(qosparam);
            qosparam:delete();
        end
    end;

    --数据统计：在浮层中，点击消息盒子量
    increase_tray_hover_wnd_click_on_msg_box_count = function()
        tqos_mgr.tray_hover_wnd_click_on_msg_box_count = tqos_mgr.tray_hover_wnd_click_on_msg_box_count + 1;
    end;

    --数据统计：在浮层中，点击“聊天消息节点”，提取单个消息窗口数量
    increase_tray_hover_wnd_click_on_talk_msg_count = function()
        tqos_mgr.tray_hover_wnd_click_on_talk_msg_count = tqos_mgr.tray_hover_wnd_click_on_talk_msg_count + 1;
    end;

    --数据统计：点击“忽略全部”的数量
    increase_tray_hover_wnd_click_ingore_count = function()
        tqos_mgr.tray_hover_wnd_click_ingore_count = tqos_mgr.tray_hover_wnd_click_ingore_count + 1;
    end;

    --数据统计：点击“查看全部”的数量
    increase_tray_hover_wnd_click_view_all_count = function()
        tqos_mgr.tray_hover_wnd_click_view_all_count = tqos_mgr.tray_hover_wnd_click_view_all_count + 1;
    end;
    
    -- 数据统计：点击闪烁图盘图标打开聊天窗口的次数
    increase_tray_icon_click_open_talk_wnd_count = function()
        tqos_mgr.tray_icon_click_open_talk_wnd_count = tqos_mgr.tray_icon_click_open_talk_wnd_count + 1;
    end;

    -- 数据统计：点击闪烁图盘图标打开消息盒子的次数
    increase_tray_icon_click_open_msg_wnd_count = function()
        tqos_mgr.tray_icon_click_open_msg_wnd_count = tqos_mgr.tray_icon_click_open_msg_wnd_count + 1;
    end;

    -- 数据统计：聊天消息触发托盘图标闪烁的次数
     increase_tray_icon_trig_talk_flash_count = function()
        tqos_mgr.tray_icon_trig_talk_flash_count = tqos_mgr.tray_icon_trig_talk_flash_count + 1;
     end;

    -- 数据统计：系统消息消息触发托盘图标闪烁的次数
     increase_tray_icon_trig_msg_flash_count = function()
        tqos_mgr.tray_icon_trig_msg_flash_count = tqos_mgr.tray_icon_trig_msg_flash_count + 1;
     end;

    report_tray_hover_wnd_data = function()
        if tqos_mgr.tray_hover_wnd_show_count > 0 or
           tqos_mgr.tray_hover_wnd_click_on_msg_box_count > 0 or
           tqos_mgr.tray_hover_wnd_click_on_talk_msg_count > 0 or
           tqos_mgr.tray_hover_wnd_click_ingore_count > 0 or 
           tqos_mgr.tray_hover_wnd_click_view_all_count > 0 or
           tqos_mgr.tray_icon_click_open_talk_wnd_count > 0 or
           tqos_mgr.tray_icon_click_open_msg_wnd_count > 0  or
           tqos_mgr.tray_icon_trig_talk_flash_count > 0 or
           tqos_mgr.tray_icon_trig_msg_flash_count > 0 then
            base_utility.log("[tqos_mgr] report_tray_hover_wnd_data, tray_hover_wnd_show_count:"..tostring(tqos_mgr.tray_hover_wnd_show_count), true);
            base_utility.log("[tqos_mgr] report_tray_hover_wnd_data, tray_hover_wnd_click_on_msg_box_count:"..tostring(tqos_mgr.tray_hover_wnd_click_on_msg_box_count), true);
            base_utility.log("[tqos_mgr] report_tray_hover_wnd_data, tray_hover_wnd_click_on_talk_msg_count:"..tostring(tqos_mgr.tray_hover_wnd_click_on_talk_msg_count), true);
            base_utility.log("[tqos_mgr] report_tray_hover_wnd_data, tray_hover_wnd_click_ingore_count:"..tostring(tqos_mgr.tray_hover_wnd_click_ingore_count), true);
            base_utility.log("[tqos_mgr] report_tray_hover_wnd_data, tray_hover_wnd_click_view_all_count:"..tostring(tqos_mgr.tray_hover_wnd_click_view_all_count), true);
            base_utility.log("[tqos_mgr] report_tray_hover_wnd_data, tray_icon_click_open_talk_wnd_count:"..tostring(tqos_mgr.tray_icon_click_open_talk_wnd_count), true);
            base_utility.log("[tqos_mgr] report_tray_hover_wnd_data, tray_icon_click_open_msg_wnd_count:"..tostring(tqos_mgr.tray_icon_click_open_msg_wnd_count), true);
            base_utility.log("[tqos_mgr] report_tray_hover_wnd_data, tray_icon_trig_talk_flash_count:"..tostring(tqos_mgr.tray_icon_trig_talk_flash_count), true);
            base_utility.log("[tqos_mgr] report_tray_hover_wnd_data, tray_icon_trig_msg_flash_count:"..tostring(tqos_mgr.tray_icon_trig_msg_flash_count), true);


            local qosparam = ierd_tgp.tpf_ui.LuaQosData:new();
            qosparam.oc_type = ierd_tgp.tpf_ui.kInstant;
            qosparam.qos_report_id = ierd_tgp.adapt_for_imports.qos.Qos_kind.kSocialMsgHoverTips; 
            qosparam.int_count = 9;
            qosparam.str_count = 0;
            qosparam.int_val[0]= tqos_mgr.tray_hover_wnd_show_count;
            qosparam.int_val[1]= tqos_mgr.tray_hover_wnd_click_on_msg_box_count;
            qosparam.int_val[2]= tqos_mgr.tray_hover_wnd_click_on_talk_msg_count;
            qosparam.int_val[3]= tqos_mgr.tray_hover_wnd_click_ingore_count;
            qosparam.int_val[4]= tqos_mgr.tray_hover_wnd_click_view_all_count;
            qosparam.int_val[5]= tqos_mgr.tray_icon_click_open_talk_wnd_count;
            qosparam.int_val[6]= tqos_mgr.tray_icon_click_open_msg_wnd_count;
            qosparam.int_val[7]= tqos_mgr.tray_icon_trig_talk_flash_count;
            qosparam.int_val[8]= tqos_mgr.tray_icon_trig_msg_flash_count;
            base_utility.lua_qos(qosparam);
            qosparam:delete();
        end
    end;

    at_exit = function(event_id,jason_str)        
        for i, count in pairs(tqos_mgr.qos_btn_click_count) do
            qosparam = ierd_tgp.tpf_ui.LuaQosData:new();
            qosparam.oc_type = 1;
            qosparam.qos_report_id = 176; --按钮上报的点击qosid
            qosparam.int_count = 3;
            qosparam.str_count =0; 
            qosparam.int_val[0]= 0;
            qosparam.int_val[1]= i;
            qosparam.int_val[2]= count;
            base_utility.log("[tqos_mgr]report, sub_type:"..i..", count:"..count);
            base_utility.lua_qos(qosparam);
            qosparam:delete();
        end;

        tqos_mgr.report_tray_hover_wnd_data();
        tqos_mgr.report_invite_count();
        tqos_mgr.report_friend_mini_card_count();
        tqos_mgr.report_self_mini_card_count();
        tqos_mgr.report_main_social_tab_click_count();
        tqos_mgr.report_social_sub_id5_click_count();
        tqos_mgr.report_social_sub_id6_click_count();
    end;

    
    group_tab_click = function(data)
        tqos_mgr.group_tab_click_count = tqos_mgr.group_tab_click_count  + 1;
    end;

    friend_tab_click = function(data)
        tqos_mgr.friend_tab_click_count = tqos_mgr.friend_tab_click_count  + 1;
    end;

    game_tab_click = function(data)
        tqos_mgr.game_tab_click_count = tqos_mgr.game_tab_click_count  + 1;
    end;

    socail_panel_default_show = function(data)
        tqos_mgr.social_panel_default_show_cnt = tqos_mgr.social_panel_default_show_cnt + 1;
    end;
    ----------------------------------------------------------------------------
    --好友查找菜单点击统计
    friend_search_menu_click = function(data)
        tqos_mgr.friend_search_menu_click_cnt = tqos_mgr.friend_search_menu_click_cnt + 1;
    end;

    friend_search_menu_qq_click = function(data)
        tqos_mgr.friend_search_menu_qq_click_cnt = tqos_mgr.friend_search_menu_qq_click_cnt + 1;
    end;

    friend_search_menu_game_click = function(data)
        tqos_mgr.friend_search_menu_game_click_cnt = tqos_mgr.friend_search_menu_game_click_cnt + 1;
    end;

    friend_search_menu_nick_click = function(data)
        tqos_mgr.friend_search_menu_nick_click_cnt = tqos_mgr.friend_search_menu_nick_click_cnt + 1;
    end;

    ------------------------------------------------------------
    --群组查找菜单点击统计
    group_search_menu_click = function(data)
        tqos_mgr.group_search_menu_click_cnt = tqos_mgr.group_search_menu_click_cnt + 1;
    end;

    group_search_menu_find_click = function(data)
        tqos_mgr.group_search_menu_find_click_cnt = tqos_mgr.group_search_menu_find_click_cnt + 1;
    end;

    group_search_menu_create_click = function(data)
        tqos_mgr.group_search_menu_create_click_cnt = tqos_mgr.group_search_menu_create_click_cnt + 1;
    end;

    guide_find_qq_friend_click = function(data)
        tqos_mgr.guide_find_qq_friend_click_cnt = tqos_mgr.guide_find_qq_friend_click_cnt + 1;
    end;
    click_create_discussion_btn = function(data)
        tqos_mgr.click_create_discussion_btn_cnt = tqos_mgr.click_create_discussion_btn_cnt + 1;
    end;

    ---------------------------------------------------------------

    incease_show_friend_gams_info_wnd_cnt = function(data)
        tqos_mgr.show_friend_gams_info_wnd_cnt = tqos_mgr.show_friend_gams_info_wnd_cnt + 1;
    end;

    incease_show_friend_gams_info_wnd_click_all_btn_cnt = function(data)
        tqos_mgr.show_friend_gams_info_wnd_click_all_btn_cnt = tqos_mgr.show_friend_gams_info_wnd_click_all_btn_cnt + 1;
    end;

    increase_mini_mode_social_ad_show_cnt = function(data)
        tqos_mgr.mini_mode_social_ad_show_cnt = tqos_mgr.mini_mode_social_ad_show_cnt + 1;
    end;

    increase_mini_mode_social_ad_click_cnt = function(data)
        tqos_mgr.mini_mode_social_ad_click_cnt = tqos_mgr.mini_mode_social_ad_click_cnt + 1;
    end;

    increase_mini_mode_social_ad_colse_cnt = function(data)
        tqos_mgr.mini_mode_social_ad_colse_cnt = tqos_mgr.mini_mode_social_ad_colse_cnt + 1;
    end;

    increase_social_panel_bottom_menu_click_cnt = function(data)
        tqos_mgr.social_panel_bottom_menu_click_cnt = tqos_mgr.social_panel_bottom_menu_click_cnt + 1;
    end;

    increase_social_panel_msg_tabl_show_times = function(data)
        tqos_mgr.social_panel_msg_tabl_show_times = tqos_mgr.social_panel_msg_tabl_show_times + 1;
    end;

    increase_social_panel_contact_tabl_show_times = function(data)
        tqos_mgr.social_panel_contact_tabl_show_times = tqos_mgr.social_panel_contact_tabl_show_times + 1;
        local tpfui =
            base_utility.get_component_adapter("ITpf_ui",
                "ierd_tgp.tpf_ui.GetTPFUI();");
        tpfui:AddInterval('tqos_mgr.on_show_contack_list', 100);
    end;

    on_show_contack_list = function()
        local tpfui =
            base_utility.get_component_adapter("ITpf_ui",
                "ierd_tgp.tpf_ui.GetTPFUI();");
        tpfui:RemoveInterval('tqos_mgr.on_show_contack_list');
        local out = comm_center.call_service('i_service_social_pannel_get_current_show_list', {});
        if out.show_list == 1 then
            tqos_mgr.increase_social_panel_group_list_show_times();
            return;
        elseif out.show_list == 2 then
            tqos_mgr.increase_social_panel_friend_list_show_times();
            return;
        else
             return;
        end
    end;

    increase_social_panel_friend_list_show_times = function(data)
        tqos_mgr.social_panel_friend_list_show_times = tqos_mgr.social_panel_friend_list_show_times + 1;
    end;

    increase_social_panel_group_list_show_times = function(data)
        tqos_mgr.social_panel_group_list_show_times = tqos_mgr.social_panel_group_list_show_times + 1;
    end;
    ---------------------------------------------------------------------

    guide_find_game_friend_click = function(data)
        tqos_mgr.guide_find_game_friend_click_cnt = tqos_mgr.guide_find_game_friend_click_cnt + 1;
    end;

    guide_find_group_click = function(data)
        tqos_mgr.guide_find_group_click_cnt = tqos_mgr.guide_find_group_click_cnt + 1;
    end;

    report_main_social_tab_click_count = function()
        if tqos_mgr.game_tab_click_count > 0 or
           tqos_mgr.group_tab_click_count > 0 or
           tqos_mgr.friend_tab_click_count > 0 or
           tqos_mgr.group_search_menu_click_cnt > 0 or
           tqos_mgr.group_search_menu_find_click_cnt > 0 or
           tqos_mgr.group_search_menu_create_click_cnt > 0 or

           tqos_mgr.friend_search_menu_click_cnt > 0 or
           tqos_mgr.friend_search_menu_nick_click_cnt > 0 or
           tqos_mgr.friend_search_menu_game_click_cnt > 0 or           
           tqos_mgr.friend_search_menu_qq_click_cnt > 0 or
           tqos_mgr.social_panel_default_show_cnt > 0 or
           tqos_mgr.group_tab_click_count_max_mode > 0 or
           tqos_mgr.friend_tab_click_count_max_mode > 0 or

           tqos_mgr.friend_search_menu_click_cnt_max_mode > 0 or
           tqos_mgr.friend_search_menu_qq_click_cnt_max_mode > 0 or
           tqos_mgr.friend_search_menu_game_click_cnt_max_mode > 0 or
           tqos_mgr.friend_search_menu_nick_click_cnt_max_mode > 0 then
           
            qosparam = ierd_tgp.tpf_ui.LuaQosData:new();
            qosparam.oc_type = ierd_tgp.tpf_ui.kInstant;
            qosparam.qos_report_id = ierd_tgp.adapt_for_imports.qos.Qos_kind.kSocialReport;
            qosparam.int_count = 18;
            qosparam.str_count = 0; 
            qosparam.int_val[0]= 4; -- sub id
            qosparam.int_val[1]= tqos_mgr.group_tab_click_count;
            qosparam.int_val[2]= tqos_mgr.friend_tab_click_count;
            ----群组查找菜单
            qosparam.int_val[3]= tqos_mgr.group_search_menu_click_cnt;
            qosparam.int_val[4]= tqos_mgr.group_search_menu_find_click_cnt;
            qosparam.int_val[5]= tqos_mgr.group_search_menu_create_click_cnt;
            ----好友查找菜单
            qosparam.int_val[6]= tqos_mgr.friend_search_menu_click_cnt;
            qosparam.int_val[7]= tqos_mgr.friend_search_menu_nick_click_cnt;
            qosparam.int_val[8]= tqos_mgr.friend_search_menu_game_click_cnt;
            qosparam.int_val[9]= tqos_mgr.friend_search_menu_qq_click_cnt;
            qosparam.int_val[10]= tqos_mgr.game_tab_click_count;
            qosparam.int_val[11] = tqos_mgr.social_panel_default_show_cnt;   -- int17
            qosparam.int_val[12] = tqos_mgr.group_tab_click_count_max_mode;  -- int18
            qosparam.int_val[13] = tqos_mgr.friend_tab_click_count_max_mode; -- int19
            -- 大界面好友查找菜单点击统计
            qosparam.int_val[14] = tqos_mgr.friend_search_menu_click_cnt_max_mode;  -- int20
            qosparam.int_val[15] = tqos_mgr.friend_search_menu_nick_click_cnt_max_mode; -- int21
            qosparam.int_val[16] = tqos_mgr.friend_search_menu_qq_click_cnt_max_mode; --int22
            qosparam.int_val[17] = tqos_mgr.friend_search_menu_game_click_cnt_max_mode; -- int23 end

            base_utility.lua_qos(qosparam);
            qosparam:delete();
        end
    end;

    report_social_sub_id5_click_count = function()
        if tqos_mgr.group_search_menu_click_cnt_max_mode > 0 or
           tqos_mgr.group_search_menu_find_click_cnt_max_mode > 0 or
           tqos_mgr.group_search_menu_create_click_cnt_max_mode > 0 or
           tqos_mgr.click_create_discussion_btn_cnt > 0  or
           tqos_mgr.guide_find_qq_friend_click_cnt > 0 or
           tqos_mgr.guide_find_game_friend_click_cnt > 0 or
           tqos_mgr.click_create_discussion_btn_cnt > 0 or
           tqos_mgr.guide_find_group_click_cnt > 0 or

           tqos_mgr.show_friend_gams_info_wnd_cnt > 0  or
           tqos_mgr.show_friend_gams_info_wnd_click_all_btn_cnt > 0  or           
           tqos_mgr.mini_mode_social_ad_show_cnt > 0  or
           tqos_mgr.mini_mode_social_ad_click_cnt > 0  or
           tqos_mgr.mini_mode_social_ad_colse_cnt > 0  or
           tqos_mgr.social_panel_bottom_menu_click_cnt > 0  or
           tqos_mgr.social_panel_msg_tabl_show_times > 0  or
           tqos_mgr.social_panel_contact_tabl_show_times > 0  or
           tqos_mgr.social_panel_friend_list_show_times > 0    or         
           tqos_mgr.social_panel_group_list_show_times > 0 then

            qosparam = ierd_tgp.tpf_ui.LuaQosData:new();
            qosparam.oc_type = ierd_tgp.tpf_ui.kInstant;
            qosparam.qos_report_id = ierd_tgp.adapt_for_imports.qos.Qos_kind.kSocialReport;
            qosparam.int_count = 18;
            qosparam.str_count = 0; 
            qosparam.int_val[0]= 5; -- sub id
            ---- 大界面群组查找菜单
            qosparam.int_val[1]= tqos_mgr.group_search_menu_click_cnt_max_mode;
            qosparam.int_val[2]= tqos_mgr.group_search_menu_create_click_cnt_max_mode;
            qosparam.int_val[3]= tqos_mgr.group_search_menu_find_click_cnt_max_mode;
            qosparam.int_val[4]= tqos_mgr.guide_find_qq_friend_click_cnt;
            qosparam.int_val[5]= tqos_mgr.guide_find_game_friend_click_cnt;
            qosparam.int_val[6]= tqos_mgr.guide_find_group_click_cnt;
            qosparam.int_val[7]= tqos_mgr.click_create_discussion_btn_cnt;

            qosparam.int_val[8]= tqos_mgr.show_friend_gams_info_wnd_cnt;
            qosparam.int_val[9]= tqos_mgr.show_friend_gams_info_wnd_click_all_btn_cnt;
            qosparam.int_val[10]= tqos_mgr.mini_mode_social_ad_show_cnt;
            qosparam.int_val[11]= tqos_mgr.mini_mode_social_ad_click_cnt;
            qosparam.int_val[12]= tqos_mgr.mini_mode_social_ad_colse_cnt;
            qosparam.int_val[13]= tqos_mgr.social_panel_bottom_menu_click_cnt;
            qosparam.int_val[14]= tqos_mgr.social_panel_msg_tabl_show_times;
            qosparam.int_val[15]= tqos_mgr.social_panel_contact_tabl_show_times;
            qosparam.int_val[16]= tqos_mgr.social_panel_friend_list_show_times;
            qosparam.int_val[17]= tqos_mgr.social_panel_group_list_show_times;

            base_utility.lua_qos(qosparam);
            qosparam:delete();
        end
    end;

    ------------------------------------
    --话题房间相关上报
    increase_click_live_room_entry_cnt = function(data)
        tqos_mgr.click_live_room_entry_cnt = tqos_mgr.click_live_room_entry_cnt + 1;
    end;

    increase_click_live_room_msg_node_cnt = function(data)
        tqos_mgr.click_live_room_msg_node_cnt = tqos_mgr.click_live_room_msg_node_cnt + 1;
    end;

    increase_click_on_exit_live_room_cnt = function(data)
        tqos_mgr.click_on_exit_live_room_cnt = tqos_mgr.click_on_exit_live_room_cnt + 1;
    end;

    increase_click_on_exit_live_and_success_room_cnt = function(data)
        tqos_mgr.click_on_exit_live_and_success_room_cnt = tqos_mgr.click_on_exit_live_and_success_room_cnt + 1;
    end;

    increase_click_on_exit_live_and_failure_room_cnt = function(data)
        tqos_mgr.click_on_exit_live_and_failure_room_cnt = tqos_mgr.click_on_exit_live_and_failure_room_cnt + 1;
    end;


    -----------------
    --点击好友列表游戏状态按钮统计
    friend_list_game_status_to_game_detail_cnt = 0;   --好友列表 游戏状态点击打开详情页次数
    friend_list_game_status_to_game_assistant_cnt = 0; --好友列表 游戏状态点击打开助手页次数
    friend_list_game_join_cnt = 0; --好友列表 加入游戏按钮的点击次数

    friend_tips_game_status_to_game_detail_cnt = 0;   --tips（mini资料卡） 游戏状态点击打开详情页次数
    friend_tips_game_status_to_game_assistant_cnt = 0; --tips（mini资料卡） 游戏状态点击打开助手页次数    
    -----------------
    increase_click_on_game_status_cnt = function(data)
        if data.type == 0 then  --点击好友列表游戏状态
            if data.sub_type == 0 then  --  跳转到游戏详情页
                tqos_mgr.friend_list_game_status_to_game_detail_cnt = tqos_mgr.friend_list_game_status_to_game_detail_cnt + 1;
            elseif data.sub_type == 1 then  -- 跳转到游戏助手
                tqos_mgr.friend_list_game_status_to_game_assistant_cnt = tqos_mgr.friend_list_game_status_to_game_assistant_cnt + 1;
            end

        elseif data.type == 1 then -- 点击好友mini资料卡
            if data.sub_type == 0 then  --  跳转到游戏详情页
                tqos_mgr.friend_tips_game_status_to_game_detail_cnt = tqos_mgr.friend_tips_game_status_to_game_detail_cnt + 1;
            elseif data.sub_type == 1 then  -- 跳转到游戏助手
                tqos_mgr.friend_tips_game_status_to_game_assistant_cnt = tqos_mgr.friend_tips_game_status_to_game_assistant_cnt + 1;
            end

        elseif data.type == 2 then  --点击加入房间
            tqos_mgr.friend_list_game_join_cnt = tqos_mgr.friend_list_game_join_cnt + 1;
        end
    end;

    report_social_sub_id6_click_count = function()
        if tqos_mgr.click_live_room_entry_cnt > 0 or 
           tqos_mgr.click_live_room_msg_node_cnt > 0 or 
           tqos_mgr.click_on_exit_live_room_cnt > 0 or 
           tqos_mgr.click_on_exit_live_and_success_room_cnt > 0 or 
           tqos_mgr.click_on_exit_live_and_failure_room_cnt > 0 or 
           tqos_mgr.friend_list_game_status_to_game_detail_cnt > 0 or 
           tqos_mgr.friend_list_game_status_to_game_assistant_cnt > 0 or 
           tqos_mgr.friend_tips_game_status_to_game_detail_cnt > 0 or 
           tqos_mgr.friend_tips_game_status_to_game_assistant_cnt > 0 or 
           tqos_mgr.socail_friend_title_click_cnt > 0 or
           tqos_mgr.socail_disc_title_click_cnt > 0 or
           tqos_mgr.socail_group_title_click_cnt > 0 or
           tqos_mgr.friend_list_game_join_cnt > 0 then

            qosparam = ierd_tgp.tpf_ui.LuaQosData:new();
            qosparam.oc_type = ierd_tgp.tpf_ui.kInstant;
            qosparam.qos_report_id = ierd_tgp.adapt_for_imports.qos.Qos_kind.kSocialReport;
            qosparam.int_count = 14;  -- !!!整形个数 ------------------每次增加需要修改!!!
            qosparam.str_count = 0; 
            qosparam.int_val[0]= 6; -- sub id

            --话题房间相关上报
            qosparam.int_val[1] = tqos_mgr.click_live_room_entry_cnt; -- int7 end
            qosparam.int_val[2] = tqos_mgr.click_live_room_msg_node_cnt; -- int8 end
            qosparam.int_val[3] = tqos_mgr.click_on_exit_live_room_cnt; -- int9 end
            qosparam.int_val[4] = tqos_mgr.click_on_exit_live_and_success_room_cnt; -- int10 end
            qosparam.int_val[5] = tqos_mgr.click_on_exit_live_and_failure_room_cnt; -- int11 end


            qosparam.int_val[6] = tqos_mgr.friend_list_game_status_to_game_detail_cnt; -- int12 end
            qosparam.int_val[7] = tqos_mgr.friend_list_game_status_to_game_assistant_cnt; -- int13 end
            qosparam.int_val[8] = tqos_mgr.friend_tips_game_status_to_game_detail_cnt; -- int14 end
            qosparam.int_val[9] = tqos_mgr.friend_tips_game_status_to_game_assistant_cnt; -- int15 end
            qosparam.int_val[10] = tqos_mgr.friend_list_game_join_cnt; -- int16 end
            qosparam.int_val[11] = tqos_mgr.socail_friend_title_click_cnt;   -- int17 end
            qosparam.int_val[12] = tqos_mgr.socail_disc_title_click_cnt;     -- int18 end
            qosparam.int_val[13] = tqos_mgr.socail_group_title_click_cnt;    -- int19 end

            base_utility.lua_qos(qosparam);
            qosparam:delete();
        end
    end;

    -- 开启自动更新功能，上报(gameid, 次数)
    report_autoupdate_open = function(btn_id, game_id)
        qosparam = ierd_tgp.tpf_ui.LuaQosData:new();
        qosparam.oc_type = 1;
        qosparam.qos_report_id = ierd_tgp.adapt_for_imports.qos.Qos_kind.kMainBtnClickReport; --按钮上报的点击qosid
        qosparam.int_count = 5;
        qosparam.str_count =1;
        qosparam.int_val[0]= 0;
        qosparam.int_val[1]= btn_id;
        qosparam.int_val[2]= 1;
        qosparam.int_val[3]= game_id;
        qosparam.str_val1 = tostring(game_id);
        base_utility.log("[report_autoupdate_open] report open game autoupdate to qos, gameid = " .. tostring(game_id));
        base_utility.lua_qos(qosparam);
        qosparam:delete();
    end;

    -- 游戏tips数据实时上报,上报(gameid, minimode/normalmode, 曝光/点击, msgid)
    report_game_tips = function(game_id, mode_id, optype_id, msg_id)
        qosparam = ierd_tgp.tpf_ui.LuaQosData:new();
        qosparam.oc_type = 1;
        qosparam.qos_report_id = ierd_tgp.adapt_for_imports.qos.Qos_kind.kUrlClick; --按钮上报的点击qosid
        qosparam.int_count = 5;
        qosparam.str_count =1;
        qosparam.int_val[0] = 9;
        qosparam.int_val[1] = game_id;
        qosparam.int_val[2] = msg_id;
        qosparam.int_val[3] = mode_id;
        qosparam.int_val[4] = optype_id;
        qosparam.str_val1 = tostring(game_id);
        base_utility.log("[report_game_tips] gametips click or show to qos, gameid = " .. tostring(game_id)..", msgid = "..tostring(msg_id));
        base_utility.lua_qos(qosparam);
        qosparam:delete();
    end;

    report_social_newwork_package_quality = function(cmd, subcmd, timeout, errorcode, time_cost)
        local qosparam = ierd_tgp.tpf_ui.LuaQosData:new();
        qosparam.oc_type = ierd_tgp.tpf_ui.kInstant;
        qosparam.qos_report_id = ierd_tgp.adapt_for_imports.qos.Qos_kind.kSocialReport;
        qosparam.int_count = 6;
        qosparam.str_count = 0; 
        qosparam.int_val[0]= 7; -- sub id
        qosparam.int_val[1]= cmd;
        qosparam.int_val[2]= subcmd;
        qosparam.int_val[3]= timeout;
        qosparam.int_val[4]= errorcode;
        qosparam.int_val[5]= time_cost;
        base_utility.log("[report_social_newwork_package_quality] report_social_network_quality, cmd = " .. tostring(cmd)..", subcmd = "..tostring(subcmd)..", timeout = "..tostring(timeout)..", errorcode = "..tostring(errorcode)..", time_cost = "..tostring(time_cost));
        base_utility.lua_qos(qosparam);
        qosparam:delete();
    end;

    socail_friend_title_click = function()
         tqos_mgr.socail_friend_title_click_cnt = tqos_mgr.socail_friend_title_click_cnt + 1;
    end;

    socail_disc_title_click = function()
        tqos_mgr.socail_disc_title_click_cnt = tqos_mgr.socail_disc_title_click_cnt + 1;
    end;

    socail_group_title_click = function()
        tqos_mgr.socail_group_title_click_cnt = tqos_mgr.socail_group_title_click_cnt + 1;
    end;

};


tqos_mgr.init();
